<?php
namespace Account\Behaviors;

use Ruben\Tcyun\TcIM;

class RegisterTcIMBehavior extends \Think\Behavior
{
    public function run(&$user)
    {
        /* 注册腾讯云通信账号 */
        $config = C('sdk.tcim');
        $tcim = new TcIM($config);
        $tcim->accountImport($user['user_id'], $user['nickname'], $user['face']);

        /* 为每个人开建一个聊天室，虽然只对主播有用 */
        // $roomName = $user['user_id'] . ' chatroom';
        // $chatroomId = $tcim->createChatroom($user['user_id'], $roomName);
        // D('Account/Users')->where(['user_id' => $user['user_id']])
        //     ->setField('chatroom', $chatroomId);


    }
}
